import { defaultCard } from '@/utils/default';

export default {
  namespace: 'cardData',
  state: {
    data: defaultCard,
    cardIns: null,
    centerImage: 'https://cose.xyz:1803/php/getPic.php?_id=62015408&w=500&h=500',
  },
  reducers: {
    'change-data'(state, { payload: addData }) {
      state.cardIns.feedData(addData);
      const newData = { ...state.data, ...addData };
      return { ...state, data: newData };
    },
    'set-card-ins'(state, { payload: cardIns }) {
      return { ...state, cardIns };
    },
    'change-center-image'(state, { payload: centerImage }) {
      return { ...state, centerImage };
    },
  },
  effects: {
    *'feed-data'({ payload: addData }: { payload: object }, { put, select }) {
    },
  }
}
